package cn.icanci.loopstack.plugin.dalgen.process;

import cn.icanci.loopstack.plugin.dalgen.engine.AbstractGeneralEngine;
import cn.icanci.loopstack.plugin.dalgen.engine.GeneralEngine;

/**
 * DAL GEN 处理器
 * 
 * @author icanci
 * @since 1.0 Created in 2022/05/14 11:27
 */
public class GeneratorProcessor implements Runnable {

    /** 生成器目标处理器 */
    private final MojoGoalGeneratorProcessor processor;
    /** 配置文件路径 */
    private final String                     filePath;

    public GeneratorProcessor(MojoGoalGeneratorProcessor processor, String filePath) {
        this.processor = processor;
        this.filePath = filePath;
    }

    @Override
    public void run() {
        this.processor.consumer.accept(this);
    }

    /**
     * Generator CRUD
     */
    public void crud() {
        GeneralEngine generalEngine = AbstractGeneralEngine.init(filePath);
        generalEngine.execute(filePath);
    }
}
